package com.offcn.sellergoods.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.offcn.sellergoods.dao.ItemCatMapper;
import com.offcn.sellergoods.pojo.ItemCat;
import com.offcn.sellergoods.service.ItemCatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ItemCatServiceImpl implements ItemCatService {

    @Autowired(required = false)
    private ItemCatMapper itemCatMapper;

    @Override
    public List<ItemCat> findByParentId(Long parentId) {
        QueryWrapper<ItemCat> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("parent_id",parentId);
        return itemCatMapper.selectList(queryWrapper);
    }

    @Override
    public ItemCat findById(Long id) {
        return itemCatMapper.selectById(id);
    }
}
